﻿package mlc.haxe.input.formatting;

/**
 * A formatter that formats a string that represents a number to a floating point.
 */
class FloatFormatter implements InputFormatter<Float> {
	/**
	 * Creates a new float formatter.
	 */
	public function new():Void {
	}
	public function format(input:String):Float {
		// Replace commas with dots.
		input = ~/[,]+/g.replace(input, ".");
		return Std.parseFloat(input);
	}
}